public void testGetAssociationsWith() {
initializeRepositoryAdmin();
ArtifactObject a1 = createBasicArtifactObject("artifact1");
FeatureObject f1 = createBasicFeatureObject("feature1");
Artifact2FeatureAssociation a2f1 = m_artifact2FeatureRepository.create(a1, f1);
List<Artifact2FeatureAssociation> b1Associations = a1.getAssociationsWith(f1);
List<Artifact2FeatureAssociation> g1Associations = f1.getAssociationsWith(a1);
assert b1Associations.size() == 1 : "The artifact has exactly one association to the feature, but it shows " + b1Associations.size() + ".";
assert b1Associations.get(0) == a2f1 : "The artifact's association should be the one we created.";
assert g1Associations.size() == 1 : "The feature has exactly one association to the artifact.";
assert g1Associations.get(0) == a2f1 : "The feature's association should be the one we created.";
}
|